# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=raft
pkgver=0.14.0
pkgrel=0
pkgdesc="C implementation of the Raft consensus protocol"
url="https://github.com/canonical/raft"
arch="all"
license="LGPL-3.0-only WITH LGPL-3.0-linking-exception"
makedepends="linux-headers libuv-dev autoconf automake libtool"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/canonical/raft/archive/v$pkgver.tar.gz
	unistd-include.patch"

prepare() {
	default_prepare
	autoreconf -i
}

build() {
	./configure \
		--prefix=/usr \
		--disable-lz4 \
		--enable-example=no
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

sha512sums="
c8b6b6428d65a7d97e74cea2b41ce443d90741afe71c3c173f2ea3c84782a892f20158f6635a8eafda6d4a729ba001ea991640d43ff6cfafdacb1b607104de3c  raft-0.14.0.tar.gz
1e0e82e42fb9a65e6135e47ef17494e40f973c9a1af8aab09ff10fdbee83b55183414ec6938205806a9f954bbefaaa5eee776bbd313072ac7ce0105f18a2be03  unistd-include.patch
"
